Add update_func callback. Call updated callback when new graphic data
authorMichael Fulbright <drmike@redhat.com>
Thu, 4 Nov 1999 20:02:37 +0000 (20:02 +0000)
committerMichael Fulbright <drmike@src.gnome.org>
Thu, 4 Nov 1999 20:02:37 +0000 (20:02 +0000)
1999-11-04  Michael Fulbright  <drmike@redhat.com>

* src/io-jpeg.c (image_begin_load): Add update_func callback.
* src/io-jpeg.c (image_load_increment): Call updated callback when
new graphic data decoded.

gdk-pixbuf/ChangeLog
gdk-pixbuf/io-jpeg.c

index c9f5c5da653eaa104db25d8a9247033390e4dcd2..88e075873123c79eb5e0456fe66cfd384b1a8775 100644 (file)
@@ -1,3 +1,9 @@
+1999-11-04  Michael Fulbright  <drmike@redhat.com>
+
+       * src/io-jpeg.c (image_begin_load): Add update_func callback.
+       * src/io-jpeg.c (image_load_increment): Call updated callback when
+       new graphic data decoded.
+
 1999-11-04  Jonathan Blandford  <jrb@redhat.com>
 
        * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_update): handle the
@@ -36,7 +42,7 @@
        * src/Makefile.am (libpixbuf_gif_la_LIBADD): Remove dependency on
        lib*gif!!!!
 
-1999-11-03  Michael Fulbright  <msf@redhat.com>
+1999-11-03  Michael Fulbright  <drmike@redhat.com>
 
        * src/io-jpeg.c (image_load_increment): Further removal of
        bugginess in local buffering code. Handles grayscale jpegs
        function.
        (gdk_pixbuf_loader_write): Use size_t for count.
 
-1999-10-27  Michael Fulbright  <msf@avatar.labs.redhat.com>
+1999-10-27  Michael Fulbright  <drmike@redhat.com>
 
        * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_destroy): Fixed
        logic so we only try to close loader if it wasn't previously closed.
 
-1999-10-27  Michael Fulbright  <msf@redhat.com>
+1999-10-27  Michael Fulbright  <drmike@redhat.com>
 
        * src/gdk-pixbuf-loader.c: Made sure image_loader struct member of
        pixbuf_loader properly initialized.
index 9d3ea3b437d3bfd3c9bac8b3cc02eb8a2b6e5fe1..cdc162fe9318db4089510f10bc1f98472a7473dc 100644 (file)
@@ -73,9 +73,10 @@ struct error_handler_data {
 
 /* progressive loader context */
 typedef struct {
-       ModulePreparedNotifyFunc notify_func;
-       gpointer                 notify_user_data;
-
+       ModuleUpdatedNotifyFunc  updated_func;
+       ModulePreparedNotifyFunc prepared_func;
+       gpointer                 user_data;
+       
        GdkPixbuf                *pixbuf;
        guchar                   *dptr;   /* current position in pixbuf */
 
@@ -87,7 +88,8 @@ typedef struct {
 } JpegProgContext;
 
 GdkPixbuf *image_load (FILE *f);
-gpointer image_begin_load (ModulePreparedNotifyFunc func, gpointer user_data);
+gpointer image_begin_load (ModulePreparedNotifyFunc func, 
+                          ModuleUpdatedNotifyFunc func2, gpointer user_data);
 void image_stop_load (gpointer context);
 gboolean image_load_increment(gpointer context, guchar *buf, guint size);
 
@@ -151,8 +153,10 @@ image_load (FILE *f)
        int w, h, i;
        guchar *pixels = NULL;
        guchar *dptr;
-       guchar *lines[4]; /* Used to expand rows, via rec_outbuf_height, from the header file:
-                          * "* Usually rec_outbuf_height will be 1 or 2, at most 4."
+       guchar *lines[4]; /* Used to expand rows, via rec_outbuf_height, 
+                           * from the header file: 
+                           * " Usually rec_outbuf_height will be 1 or 2, 
+                           * at most 4."
                           */
        guchar **lptr;
        struct jpeg_decompress_struct cinfo;
@@ -271,14 +275,17 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes)
  */
 
 gpointer
-image_begin_load (ModulePreparedNotifyFunc func, gpointer user_data)
+image_begin_load (ModulePreparedNotifyFunc prepared_func, 
+                 ModuleUpdatedNotifyFunc  updated_func,
+                 gpointer user_data)
 {
        JpegProgContext *context;
        my_source_mgr   *src;
 
        context = g_new0 (JpegProgContext, 1);
-       context->notify_func = func;
-       context->notify_user_data = user_data;
+       context->prepared_func = prepared_func;
+       context->updated_func  = updated_func;
+       context->user_data = user_data;
        context->pixbuf = NULL;
        context->got_header = FALSE;
        context->did_prescan = FALSE;
@@ -451,10 +458,8 @@ image_load_increment (gpointer data, guchar *buf, guint size)
                        context->dptr = context->pixbuf->art_pixbuf->pixels;
 
                        /* Notify the client that we are ready to go */
-
-                       if (context->notify_func)
-                               (* context->notify_func) (context->pixbuf,
-                                                         context->notify_user_data);
+                       (* context->prepared_func) (context->pixbuf,
+                                                   context->user_data);
 
                } else if (!context->did_prescan) {
                        int rc;
@@ -502,6 +507,14 @@ image_load_increment (gpointer data, guchar *buf, guint size)
 
                                context->dptr += nlines * context->pixbuf->art_pixbuf->rowstride;
 
+                               /* send updated signal */
+                               (* context->updated_func) (context->pixbuf,
+                                                context->user_data,
+                                                0, 
+                                                cinfo->output_scanline-1,
+                                                cinfo->image_width, 
+                                                nlines);
+
 #undef DEBUG_JPEG_PROGRESSIVE
 #ifdef DEBUG_JPEG_PROGRESSIVE